<?php
class AdminController extends BaseController {

    public $layout = "common/admin-layout.html";

    //管理后台首页
    public function actionIndex(){
        
    }

    //URL规则维护页
    public function actionUrlRule(){
        $this->rule = file_get_contents(BASE_DIR.'/protected/data/url-rule.cf');
    }

    public function actionSetUrlRule(){
        $rule = $this->arg('rule');
        file_put_contents(BASE_DIR . 'protected/data/url-rule.cf', $rule);//这里要防XSS
        $this->jsonOutput(array('rs' => true, 'msg' => '写入成功'));
    }

    //获取任务列表 - HTML
    public function actionTaskList(){
        $status = $this->arg('status', 'all');
        $p = $this->arg('p', 1);
        $limit = $this->arg('limit', 8);
        $ret = obj('GrabTask')->getList($status, $p, $limit);
        $this->list = $ret['list'];
        $this->pages = $ret['pages'];
        $this->status = $status;
    }

}